package jsyf.oa.dao.system;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import jsyf.oa.entity.system.User2RightOpEntity;
import jsyf.oa.idao.BaseDao;
import jsyf.oa.ientity.IBaseEntity;
import org.springframework.stereotype.Repository;

/**
 * Created by Lenovo on 2017/12/11.
 */
@Repository
public class User2RightOpDao extends BaseDao {
    public User2RightOpDao() {
        this.iBaseEntity = new User2RightOpEntity();
    }

    @Override
    public IBaseEntity convertJson2Entity(JSONObject json) {
        return  JSON.toJavaObject(json, User2RightOpEntity.class);
    }

    public boolean exist(String userId,String rightOpId){
        return this.getJSONListByCondition(" AND USER_ID = ? AND RIGHT_OP_ID = ? ",new Object[]{userId,rightOpId}).size()>0;
    }
}
